<html>
<head><meta charset="utf-8"><title>Unfortunate tidy fmt + unsafe-doc interaction · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html">Unfortunate tidy fmt + unsafe-doc interaction</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209897165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209897165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209897165">(Sep 12 2020 at 19:53)</a>:</h4>
<p>I had some code like this</p>
<div class="codehilite"><pre><span></span><code>/// SAFETY ...
let x = unsafe { ... }
</code></pre></div>


<p>But fmt complained to me that it needed to be</p>
<div class="codehilite"><pre><span></span><code>/// SAFETY ...
let x =
    unsafe { ... }
</code></pre></div>


<p>So ok, I did that.</p>
<p>But then the safety-comment checker complained at me, wanting</p>
<div class="codehilite"><pre><span></span><code>let x =
    /// SAFETY ...
    unsafe { ... }
</code></pre></div>


<p>This is obviously all survivable, but it sure would be nice to avoid the two-step...</p>



<a name="209897235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209897235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209897235">(Sep 12 2020 at 19:55)</a>:</h4>
<p>We should probably be okay with SAFETY until the next <code>;</code>, even if that's not perfect</p>



<a name="209897240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209897240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209897240">(Sep 12 2020 at 19:55)</a>:</h4>
<p>or even just "SAFETY" takes effect for the next unsafe block, no matter how far away, which'll miss some cases but not too worried about that</p>



<a name="209901734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209901734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209901734">(Sep 12 2020 at 22:01)</a>:</h4>
<p>this bit me with <code>array_chunks_mut</code> too, as I fixed here:<br>
<a href="https://github.com/rust-lang/rust/pull/75021/commits/86b9f710d0c90068866e736bbbb7b89ac93ff2e6#diff-e5a4dbd27d5eadb7a3cf746c396f5420L1073-R1076">https://github.com/rust-lang/rust/pull/75021/commits/86b9f710d0c90068866e736bbbb7b89ac93ff2e6#diff-e5a4dbd27d5eadb7a3cf746c396f5420L1073-R1076</a></p>



<a name="209905605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209905605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209905605">(Sep 12 2020 at 23:58)</a>:</h4>
<p>Ah, I see -- that explains why it was formatted slightly differently from the non-mut case.  I'd been wondering <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="209939761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unfortunate%20tidy%20fmt%20%2B%20unsafe-doc%20interaction/near/209939761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unfortunate.20tidy.20fmt.20.2B.20unsafe-doc.20interaction.html#209939761">(Sep 13 2020 at 16:58)</a>:</h4>
<p>yeah I had that same problem recently as well^^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>